(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
"use strict";

(function () {
    var template = function template(msg) {
        return "\n<aux-view class=\"aup-coutdown\">\n    <aux-view class=\"content\">" + msg + "</aux-view>\n</aux-view>\n        ";
    };

    (function () {

        function onClickTap(self) {
            return function (e) {
                e.stopPropagation();
                if (!self.$locked) {
                    self.$time = 60;
                    self.$locked = true;
                    self.$ele.root.auiAddOnceClass("locked");
                    self.$ele.content.innerHTML = sprintf(self.$format, {
                        value: self.$time
                    });
                    self.dispatchEvent(new CustomEvent("mystart", {
                        detail: {}
                    }));
                    self.$task = setInterval(function () {
                        self.$time = self.$time - 1;
                        if (self.$time > 0) {
                            self.$ele.content.innerHTML = sprintf(self.$format, {
                                value: self.$time
                            });
                        } else {
                            clearInterval(self.$task);
                            self.$task = -1;
                            self.$locked = false;
                            self.$ele.root.auiRemoveOnceClass("locked");
                            self.$ele.content.innerHTML = self.$default;
                            self.dispatchEvent(new CustomEvent("myend", {
                                detail: {}
                            }));
                        }
                    }, 1000);
                }
            };
        }

        return window.defineCustomElement('aup-coutdown', {
            createdCallback: { value: function value() {} },
            attachedCallback: { value: function value() {
                    var self = this;
                    self.$task = -1;
                    self.$ele = {};
                    self.$time = 60;
                    self.$locked = false;
                    self.$default = window.aui.getAttribute(self, "msg", "msg");
                    self.$format = window.aui.getAttribute(self, "format", "@{value}秒重新获取");
                    self.innerHTML = template(self.$default);
                    self.$ele.root = window.AuifindSelector(self, "> .aup-coutdown");
                    self.$ele.content = self.$ele.root.children[0];
                    self.$onClicked = onClickTap(self);
                    self.$ele.root.addEventListener("click", self.$onClicked);
                } },
            attributeChangedCallback: { value: function value(name, oldval, newval) {
                    // console.log(name + ":" + oldval + "," + newval);
                    var self = this;
                    if (name === "format") {
                        self.$format = newval;
                    }
                } }
        });
    })();

    document.createElement('aup-coutdown');
})();
},{}]},{},[1])